package kr.co.goodwilldd.framework.controlAdvice;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * Common Action in All Contoller
 * 
 * @author GoodwillDD (kr.goodwilldd@gmail.com)
 * 
 */
@ControllerAdvice
public class BaseControllerAdviceConfig {

	private static final Logger logger = LoggerFactory
			.getLogger(BaseControllerAdviceConfig.class);

	/**
	 * example!!!!
	 * 
	 * <pre>
	 * TODO 작업해야함!
	 * @ExceptionHandler({ NullPointerException.class })
	 * public ResponseEntity<String> handlePersonNotFound(NullPointerException pe) {
	 *	return new ResponseEntity<String>(pe.getMessage(), HttpStatus.NOT_FOUND);
	 * }
	 * </pre>
	 * 
	 * @param pe
	 * @return
	 */
	@ExceptionHandler( {Exception.class} )
	public String handlerSomeException(Exception e) {
		logger.error("find error!!", e);
		return "redirect:/errors.in";
	}
}
